/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package moviedownloader5;

import java.util.concurrent.atomic.AtomicLong;
import javax.sql.DataSource;
import org.postgresql.ds.PGPoolingDataSource;

/**
 *
 * @author martin100
 */
public class DataSourceProvider {
    
    private static AtomicLong id = new AtomicLong(0);

    public static DataSource getDataSource() {
        PGPoolingDataSource source = new PGPoolingDataSource();
        source.setDataSourceName("JPolievkaDataSource"+id.getAndIncrement());
        source.setServerName("localhost");
        source.setPortNumber(5432);
        source.setDatabaseName("PDT");
        source.setUser("postgres");
        source.setPassword("admin");
        source.setMaxConnections(100);
        return source;
    }

}
